// 导入组件
import Vue from 'vue';
import Router from 'vue-router';
import store from '../vuex/store';
// 登录
import login from '@/views/login';
import loginAdmin from '@/views/loginAdmin';
import register from '@/views/register';
// 首页
import index from '@/views/index';
// 我的钱包
import wallet from '@/views/myWallet/wallet';
import recharge from '@/views/myWallet/recharge';
import withdrawal from '@/views/myWallet/withdrawal';
import transfer from '@/views/myWallet/transfer';
import walletAdmin from '@/views/myWalletAdmin/walletAdmin';
import rechargeAdmin from '@/views/myWalletAdmin/rechargeAdmin';
import withdrawalAdmin from '@/views/myWalletAdmin/withdrawalAdmin';
import WarningInformation from '@/views/myWalletAdmin/WarningInformation';
import WLHcard from '@/views/payAdmin/WLHcard'; 
import cardListAir from '@/views/cardListAir/index';  


import transferAdmin from '@/views/myWalletAdmin/transferAdmin';
import MatrixTransfer from '@/views/myWalletAdmin/MatrixTransfer'; 


import codeSet from '@/views/user/codeSet';



/**
 * 支付管理
 */
import cards from '@/views/pay/cards';
import cardItem from '@/views/pay/cardItem';
import cardsRecharge from '@/views/pay/recharge';
import sellingCards from '@/views/pay/sellingCards';
import Order from '@/views/pay/Order';
import searchCode from '@/views/pay/searchCode';
import fee from '@/views/pay/fee';
import cardholder from '@/views/pay/cardholder';
import nkGroup from '@/views/pay/nkGroup'; 

import WLHcardUser from '@/views/wlh/WLHcardUser';
import WLHOrder from '@/views/wlh/WLHOrder';
import WLHsearchCode from '@/views/wlh/searchCode';
import WLHfee from '@/views/wlh/fee'; 
import WLHnkGroup from '@/views/wlh/nkGroup';  
import WLHcardLog from '@/views/wlh/cardLog'; 
 
import cardsAdmin from '@/views/payAdmin/cardsAdmin';
import cardsRechargeAdmin from '@/views/payAdmin/rechargeAdmin';
import sellingCardsAdmin from '@/views/payAdmin/sellingCardsAdmin';
import OrderAdmin from '@/views/payAdmin/OrderAdmin';
import feeAdmin from '@/views/payAdmin/feeAdmin';

import WLHOrderAdmin from '@/views/wlh/OrderAdmin';
import WLHfeeAdmin from '@/views/wlh/feeAdmin';

import wlhLog from '@/views/wlh/wlhLog'; 
// import WLHfeeAdmin from '@/views/wlh/feeAdmin'; 

// 通知公告
import notice from '@/views/notify/notice';
import noticeAdmin from '@/views/notify/noticeAdmin';
// import Goods from '@/views/myWallet/Goods';

/**
 * 信息管理
 */
import myInfo from '@/views/user/myInfo';
import myInfo2 from '@/views/user/myInfo2';

import userList from '@/views/user/userList';
import userItem from '@/views/user/userItem';
import authRecordList from '@/views/user/authRecordList';
import feeList from '@/views/user/feeList';
import feeListAgent from '@/views/user/feeListAgent'; 
import agentRate from '@/views/user/agentRate';  

import gAuth from '@/views/user/gAuth';
import companyAuth from '@/views/user/companyAuth';

// 子账号 
import subAccount from '@/views/subAccount/subAccount';
import tradeFeeAgent from '@/views/pay/tradeFeeAgent';

import AgentProfits from '@/views/pay/AgentProfits';
import CardOpeningLog from '@/views/pay/CardOpeningLog'; 
 

// 会员浮动费率
import huiyuanFuDong  from  '@/views/user/huiyuanFuDong' 
const secretKey = '123456321456';
const CryptoJS = require('crypto-js');
// 启用路由
Vue.use(Router);
// let admin = "", url = window.location.href, routesD = null, info = decryptp(window.sessionStorage.getItem("userInfo")) ;
let admin = "", url = window.location.href, routesD = null, info = window.sessionStorage.getItem("uussffoo"); 

 
 if(info){
  const bytes = CryptoJS.AES.decrypt(info, secretKey);
  info = bytes.toString(CryptoJS.enc.Utf8)
}
url = url.split('/').filter(part => part)
url = url[url.length - 1];
if (url == 'loginAdmin') {
  admin = '00' || '03';
}
// info = decryptp(info);
if (info !== null && info !== undefined && info !== '') { 
  // console.log(decrypt(info),'info main22') 
  // info =  JSON.parse(info?decryptp(info):{});   
  // const bytes = CryptoJS.AES.decrypt(info, secretKey);
  // info = CryptoJS.AES.decrypt(info, secretKey).toString(CryptoJS.enc.Utf8);
  info = JSON.parse(info); 
  
  admin = info.userType;
}
// 导出路由 
if (admin == '00'||admin == '03') {
  routesD = new Router({ 
    routes: [
      {
      path: '/',
      name: '管理员登录',
      component: loginAdmin,
      redirect: {
        path: '/login',
      },
      hidden: true,
      meta: {
        requireAuth: false
      }
    }, {
      path: '/login',
      name: '管理员登录',
      component: login,
      hidden: true,
      meta: {
        requireAuth: false
      }
    }, 
    {
      path: '/index',
      name: '首页',
      component: index,
      iconCls: 'el-icon-tickets',
      children: [{
        path: '/walletAdmin',
        name: '会员统计',
        component: walletAdmin,
        meta: {
          requireAuth: true
        }
      }, {
        path: '/rechargeAdmin',
        name: '充值审核',
        component: rechargeAdmin,
        meta: {
          requireAuth: true
        }
      }, {
        path: '/withdrawalAdmin',
        name: '提现审核',
        component: withdrawalAdmin,
        meta: {
          requireAuth: true
        }
      }, {
        path: '/WarningInformation',
        name: '预警信息',
        component: WarningInformation,
        meta: {
          requireAuth: true
        }
      },  
      
      {
        path: '/transferAdmin',
        name: '转账审核',
        component: transferAdmin,
        meta: {
          requireAuth: true
        }
      }, {
        path: '/OrderAdmin',
        name: '交易记录',
        component: OrderAdmin,
        meta: {
          requireAuth: true
        }
      },
      {
        path: '/feeAdmin',
        name: '手续费记录',
        component: feeAdmin,
        meta: {
          requireAuth: true
        }
      }, {
        path: '/sellingCardsAdmin',
        name: '销卡列表',
        component: sellingCardsAdmin,
        meta: {
          requireAuth: true
        }
      }, {
        path: '/cardsAdmin',
        name: 'Gwhale卡管理',
        component: cardsAdmin,
        meta: {
          requireAuth: true
        }
      }, 
      {
        path: '/WLHcard',
        name: 'Gwhale星汇卡',
        component: WLHcard,
        meta: {
          requireAuth: true
        }
      },  

      {
        path: '/CardOpeningLog',
        name: '开卡日志',
        component: CardOpeningLog,
        meta: {
          requireAuth: true
        }
      },
      {
        path: '/wlhLog',
        name: '开卡日志11',
        component: wlhLog,
        meta: {
          requireAuth: true
        }
      },      
      {
        path: '/WLHcardUser',
        name: 'Gwhale星汇卡',
        component: WLHcardUser,
        meta: {
          requireAuth: true
        }
      }, 
      {
        path: '/WLHfeeAdmin',
        name: '手续费明细',
        component: WLHfeeAdmin,
        meta: {
          requireAuth: true
        }
      },  
      {
        path: '/WLHOrderAdmin',
        name: '交易明细',
        component: WLHOrderAdmin,
        meta: {
          requireAuth: true
        }
      }, 
      {
        path: '/WLHOrder',
        name: '交易明细1',
        component: WLHOrder,
        meta: {
          requireAuth: true
        }
      },

      
      
      {
        path: '/payrechargeAdmin',
        name: '充值/退款记录',
        component: cardsRechargeAdmin,
        meta: {
          requireAuth: true
        }
      }, {
        path: '/authRecordList',
        name: '认证审核',
        component: authRecordList,
        meta: {
          requireAuth: true
        }
      },{
        path: '/gAuth',
        name: 'GoogleAuth认证',
        component: gAuth,
        meta: {
          requireAuth: true
        } 
      }, {
        path: '/userList',
        name: '会员管理',
        component: userList,
        meta: {
          requireAuth: true
        }
      }, {
        path: '/userItem',
        name: '会员信息',
        component: userItem,
        meta: {
          requireAuth: true
        }
      }, {
        path: '/noticeAdmin',
        name: '通知公告',
        component: noticeAdmin,
        meta: {
          requireAuth: true
        }

      },  
      
      {
        path: '/codeSet',
        name: '验证码设置',
        component: codeSet,
        meta: {
          requireAuth: true
        }
      },

      {
        path: '/feeList',
        name: '费率配置',
        component: feeList,
        meta: {
          requireAuth: true
        }
      },
      {
        path: '/feeListAgent',
        name: '代理商成本费率配置',
        component: feeListAgent,
        meta: {
          requireAuth: true
        }
      },

      {
        path: '/agentRate',
        name: '代理商分成比例',
        component: agentRate,
        meta: {
          requireAuth: true
        }
      }, 
      

      {
        path: '/myInfo',
        name: '用户信息',
        component: myInfo,
        meta: {
          requireAuth: true
        }
      },
      {
        path: '/subAccount',
        name: '子账号管理',
        component: subAccount,
        meta: {
          requireAuth: true
        } 
      }, 
      {
        path: '/tradeFeeAgent',
        name: 'NK分成明细',
        component: tradeFeeAgent,
        meta: {
          requireAuth: true
        } 
      }, 
      {
        path: '/AgentProfits',
        name: '分成利润',
        component: AgentProfits,
        meta: {
          requireAuth: true
        } 
      },  
      {
        path: '/CardOpeningLog',
        name: '开卡日志',
        component: CardOpeningLog,
        meta: {
          requireAuth: true
        } 
      }, 
      {
        path: '/WLHfeeAdmin',
        name: '开卡日志',
        component: WLHfeeAdmin,
        meta: {
          requireAuth: true
        }
      },   
      
      {
        path: '/huiyuanFuDong',
        name: '会员浮动费率',
        component: huiyuanFuDong,
        meta: {
          requireAuth: true
        } 
      },
      {
        path: '/MatrixTransfer',
        name: '共享卡钱包',
        component: MatrixTransfer,
        meta: {
          requireAuth: true
        } 
      },  
      {
        path: '/cardListAir',
        name: '云汇卡列表',
        component: cardListAir,
        meta: {
          requireAuth: true
        } 
      } 
      
      
    
     ]
    }]
  })
} else {
  routesD = new Router({ 
    routes: [{
      path: '/',
      name: '用户登录',
      component: login,
      redirect: {
        path: '/login',
      },
      hidden: true,
      meta: {
        requireAuth: false
      }
    }, {
      path: '/login',
      name: '用户登录',
      component: login,
      hidden: true,
      meta: {
        requireAuth: false
      }
    }, {
      path: '/register',
      name: '注册',
      component: register,
      hidden: true,
      meta: {
        requireAuth: false
      }
    }, {
      path: '/index',
      name: '首页',
      component: index,
      iconCls: 'el-icon-tickets',
      children: [{
        path: '/wallet',
        name: '我的钱包',
        component: wallet,
        meta: {
          requireAuth: true
        }
      }, {
        path: '/recharge',
        name: '充值管理',
        component: recharge,
        meta: {
          requireAuth: true
        }
      }, {
        path: '/withdrawal',
        name: '提现管理',
        component: withdrawal,
        meta: {
          requireAuth: true
        }
      }, {
        path: '/transfer',
        name: '转账管理',
        component: transfer,
        meta: {
          requireAuth: true
        }
      }, {
        path: '/Order',
        name: '交易订单',
        component: Order,
        meta: {
          requireAuth: true
        }
      },{
        path: '/searchCode',
        name: '3ds码查询',
        component: searchCode,
        meta: {
          requireAuth: true
        }
      }, 
      {
        path: '/codeSet',
        name: '验证码设置',
        component: codeSet,
        meta: {
          requireAuth: true
        }
      },
      {
        path: '/MatrixTransfer',
        name: '共享卡钱包',
        component: MatrixTransfer,
        meta: {
          requireAuth: true
        } 
      },   
      
      {
        path: '/fee',
        name: '手续费明细',
        component: fee,
        meta: {
          requireAuth: true
        }
      }, {
        path: '/cardholder',
        name: '持卡人列表',
        component: cardholder,
        meta: {
          requireAuth: true
        }
      }, {
        path: '/sellingCards',
        name: '销卡列表',
        component: sellingCards,
        meta: {
          requireAuth: true
        }
      }, 
      {
        path: '/cards',
        name: 'Gwhale卡管理',
        component: cards,
        meta: {
          requireAuth: true
        }
      }, 
      {
        path: '/WLHcardUser',
        name: 'Gwhale星汇卡',
        component: WLHcardUser,
        meta: {
          requireAuth: true
        }
      }, 
      {
        path: '/WLHfeeAdmin',
        name: '手续费明细',
        component: WLHfeeAdmin,
        meta: {
          requireAuth: true
        }
      },  
      {
        path: '/WLHOrderAdmin',
        name: '交易明细',
        component: WLHOrderAdmin,
        meta: {
          requireAuth: true
        }
      }, 
      {
        path: '/nkGroup',
        name: '分组管理',
        component: nkGroup,
        meta: {
          requireAuth: true
        }
      }, 
      {
        path: '/WLHnkGroup',
        name: '分组管理',
        component: WLHnkGroup,
        meta: {
          requireAuth: true
        }
      }, 
      {
        path: '/WLHsearchCode',
        name: '3ds码查询',
        component: WLHsearchCode,
        meta: {
          requireAuth: true
        }
      },  
      
      {
        path: '/WLHfee',
        name: '手续费明细',
        component: WLHfee,
        meta: {
          requireAuth: true
        }
      },  
      {
        path: '/cardItem',
        name: 'NK卡详情',
        component: cardItem,
        meta: {
          requireAuth: true
        }
      }, {
        path: '/payrecharge',
        name: '充值管理',
        component: cardsRecharge,
        meta: {
          requireAuth: true
        }
      }, {
        path: '/companyAuth',
        name: '企业认证',
        component: companyAuth,
        meta: {
          requireAuth: true
        }
      },  {
        path: '/myInfo2',
        name: '用户信息',
        component: myInfo2,
        meta: {
          requireAuth: true
        }
      }, {
        path: '/gAuth',
        name: 'GoogleAuth认证',
        component: gAuth,
        meta: {
          requireAuth: true
        } 
      },{
        path: '/notice',
        name: '通知公告',
        component: notice,
        meta: {
          requireAuth: true
        } 
      },
      {
        path: '/subAccount',
        name: '子账号管理',
        component: subAccount,
        meta: {
          requireAuth: true
        } 
      }, 
      {
        path: '/tradeFeeAgent',
        name: 'NK分成明细',
        component: tradeFeeAgent,
        meta: {
          requireAuth: true
        } 
      }, 
      {
        path: '/AgentProfits',
        name: '分成利润',
        component: AgentProfits,
        meta: {
          requireAuth: true
        } 
      }, 
      {
        path: '/CardOpeningLog',
        name: '开卡日志',
        component: CardOpeningLog,
        meta: {
          requireAuth: true
        } 
      }, 
      {
        path: '/wlhLog',
        name: '开卡日志',
        component: wlhLog,
        meta: {
          requireAuth: true
        } 
      },   
      


      ]
    }]
  })
}
 
export default routesD
